import pyotp
import qrcode               # pip install qrcode[pil]
from loguru import logger


__version__ = '1.0.0'
__author__ = 'notmmao@gmail.com'

def main():
    secret = pyotp.random_base32()
    url = pyotp.TOTP(secret).provisioning_uri(name='otp', issuer_name='notmmao')
    
    logger.info(f"secret: {secret}")
    logger.info(f"url: {url}")
    
    img = qrcode.make(url)
    img.save("otp.png")
    img.show()

if __name__ == '__main__':
    main()

